Content Processors
-------------------------------------------------- 

Content Processors are the final step before a piece of content is added to the HTML/XHTML document.  Content Processors can be used to apply programmatic transformations to a piece of content once it's been loaded.  This would include things like applying the Markdown, Smarty, or Textile processing filters, cleaning up shoddy HTML from the database, adding custom markup, adding ad tags, or any other transformation you want.  

Each section has its own processor. Processors can be used by multiple sections.  A section may use multiple processors.

To create a Content Processor, you'll write a class that extends the ContentCourierProcessorFactory, and defines a single method named processContent which accepts a single parameter.  The class should be named with the form ContentCourierProcessorX.  The parameter for the processContent method will contain the loaded content for a section.

For example, the default deployment defines a processor for Markdown

    class ContentCourierProcessorMarkdown extends ContentCourierProcessorFactory{
        public function processContent($string){
            return Markdown($string);
        }
    }

This processor would run the loaded content through the Markdown function (defined in the markdown.php file, required at the top of the Deployment page)

Processor Config
-------------------------------------------------- 
You may define Content Processors in three locations.  The first is the default processor, set in an attribute of the &lt;sections /&gt; node

    <sections defaultProcessor="none">
    
The processor here will be used for all sections.  A value of **none** indicates that no extra processing should be done. (This is achieved with a processor named ContentCourierProcessorNone that ships with the base Content Courier system)

Each section may have its own processor as well, set in an atrtibute of the particular section node

    <footer defaultContentURI="/footer.php" processor="Markdown" />

Finally, each map node may have it's own processor as well.

    <main defaultContentURI="/home.php" processor="none">
        <map pageURI="/faq" contentURI="/faq.txt" processor="Markdown" />
    </main>
    
Multiple Processors
-------------------------------------------------- 
Each of the above attributes may specify multiple processors by using a comma separated list.  Processors will be applied in order they're listed. For example, in the default deployment, we use both Mardown and Smary. We need to apply Markdown first as Smary may replace some valid Markdown markup.

    <main defaultContentURI="/home.php" processor="Markdown,Smarty">
    
Reserved Names    
-------------------------------------------------- 
The default ContentCourier application ships with two ContentProcessors, one named "none", the other named "AssemblyLine".  These are reserved names, and may not be used as names for your own processors.

